var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var a = (function () {
    function t() {
        this.curMoveDir = !0;
        this.lastMoveTime = 0;
        this.limiteTime = 200;
        this.tempDirDis = 0;
        this.lastY = 0;
        this.last2Y = 0;
        this.lastMoveDir = !1;
        this.curTmepMoveDir = !1;
        this.moveStatus = !1;
        this.nextMoveStatus = !1;
        this.isInit = !1;
    }
    t.prototype.setCall = function (t) {
        this.setViewDir = t;
        this.setResetDir();
        this.curMoveDir = !1;
        this.isInit = !0;
        this.nextMoveStatus = !1;
        this.curTmepMoveDir = !0;
        this.lastMoveDir = !0;
        this.last2Y = 999;
        this.setViewDir && this.setViewDir(!this.curMoveDir);
    };
    t.prototype.setCurPos = function (t) {
        if (this.isInit && Date.now() - this.lastMoveTime > this.limiteTime && this.lastY != t) {
            this.tempDirDis = this.lastY - t;
            this.lastY = t;
            this.nextMoveStatus = Math.abs(this.tempDirDis) < 10 ? this.nextMoveStatus : this.tempDirDis > 0;
            if (this.nextMoveStatus == this.curTmepMoveDir) {
                if (this.moveStatus == this.nextMoveStatus) {
                    if (Math.abs(this.last2Y - t) > 2) {
                        this.curMoveDir = this.last2Y < t;
                        this.curMoveDir != this.moveStatus && this.setViewDir && this.setViewDir(!this.curMoveDir);
                        this.moveStatus = this.curMoveDir;
                    }
                } else this.setResetDir();
            } else {
                this.last2Y = t;
                this.curTmepMoveDir = this.nextMoveStatus;
            }
        }
    };
    t.prototype.setResetDir = function () {
        this.lastMoveTime = Date.now();
    };
    return t;
})();
o.default = a;
